# Contributor: Marian Buschsieweke <marian.buschsieweke@posteo.net>
# Maintainer: Marian Buschsieweke <marian.buschsieweke@posteo.net>
pkgname=py3-edalize
_pkgname=edalize
pkgver=0.5.4
pkgrel=0
pkgdesc="An abstraction library for interfacing EDA tools"
url="https://github.com/olofk/edalize"
license="BSD-2-Clause"
arch="all"
depends="
	py3-jinja2
	py3-pandas
	py3-parsing
	py3-yaml
	python3
	"
makedepends="
	py3-setuptools
	py3-gpep517
	py3-wheel
	py3-installer
	"
checkdepends="
	iverilog
	py3-pytest
	"
subpackages="
	$pkgname-pyc
	"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/olofk/edalize/archive/refs/tags/v$pkgver.tar.gz
	"
builddir="$srcdir/$_pkgname-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages "$srcdir"/testenv
	"$srcdir"/testenv/bin/python3 -m installer dist/*.whl

	# deselect tests:
	# - spyglass: Synopsys Spyglass is not packaged and, therefore,
	#             the abstraction of that EDA will not work.
	# - icarus: Sporadically fails
	PATH="$srcdir/testenv/bin:$PATH" "$srcdir"/testenv/bin/python3 \
		-m pytest -v \
		--deselect tests/test_spyglass.py::test_spyglass_defaults \
		--deselect tests/test_spyglass.py::test_spyglass_tooloptions \
		--deselect tests/test_icarus.py::test_icarus
}

package() {
	python3 -m installer -d "$pkgdir" \
		"$builddir"/dist/*.whl
}

sha512sums="
67ed4e59c0e82d3e72cec215ad781809fa0ca2c2d534c13897120d69ead85eef8234eccd19955d6963e11835d5a0ee71c4c19f4217bb851e0f8f1634bb2ff7cb  py3-edalize-0.5.4.tar.gz
"
